//
//  DecaticTableViewCell.m
//  庐山通
//
//  Created by zcj on 15-10-30.
//  Copyright (c) 2015年 郑朝军. All rights reserved.
//

#import "DecaticTableViewCell.h"
#import "TravelDecatilFrame.h"
#import "TravelDecatil.h"
#import <UIKit/UIKit.h>
#import "Grouble.h"


@interface DecaticTableViewCell()
@property (nonatomic,weak)UIImageView * topView;
@property (nonatomic,weak)UILabel * userName;

@property (nonatomic,weak)UILabel * status;
@property (nonatomic,weak)UILabel * content;
@property (nonatomic,weak)UILabel * grouptitle;

@property (nonatomic,weak)UILabel * rank;
@property (nonatomic,weak)UILabel * seqid;
@property (nonatomic,weak)UILabel * posttime;

@end
@implementation DecaticTableViewCell

+ (instancetype)DecaticTableViewCell:(UITableView *)tableView
{
    static NSString * ID = @"DecaticCell";
    DecaticTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[DecaticTableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    return cell;
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // 图片
        UIImageView * topView = [[UIImageView alloc]init];
        [self addSubview:topView];
        self.topView = topView;
        //  // 用户名
        
        UILabel * userName = [[UILabel alloc]init];
        userName.font = [UIFont systemFontOfSize:12];
        
        //userName.numberOfLines = 0;
        [self addSubview:userName];
        self.userName = userName;
        // 标题
        //CGFloat grouptitleX
        UILabel * grouptitle = [[UILabel alloc]init];
        grouptitle.textAlignment = NSTextAlignmentCenter;
        grouptitle.font = [UIFont systemFontOfSize:15];
        grouptitle.textColor = ZCJColor(240, 140, 19);
        grouptitle.backgroundColor = [UIColor clearColor];
       //grouptitle.numberOfLines = 0;
        [self addSubview:grouptitle];
        self.grouptitle = grouptitle;
        // 普通用户
       // CGFloat statusX
        UILabel * status = [[UILabel alloc]init];
        status.font = [UIFont systemFontOfSize:15];
        status.backgroundColor = [UIColor clearColor];
        status.textAlignment = NSTextAlignmentCenter;
        status.textColor =  ZCJColor(240, 140, 19);
        status.numberOfLines = 0;
        [self addSubview:status];
        self.status = status;
        // 内容
        //CGFloat contentX
        UILabel * content = [[UILabel alloc]init];
        content.numberOfLines = 0;
        content.backgroundColor = [UIColor clearColor];
        content.font = [UIFont systemFontOfSize:20];
        
        [self addSubview:content];
        self.content = content;
        
//        / 赞
//        @property (nonatomic,strong)NSString * rank;
//        // 拼论
//        @property (nonatomic,strong)NSString * seqid;
//        // 浏览量
//        @property (nonatomic,strong)NSString * posttime;
        // 赞
        UILabel * rank = [[UILabel alloc]init];
        rank.numberOfLines = 0;
        rank.font = [UIFont systemFontOfSize:15];
        rank.textColor = ZCJColor(240, 140, 19);
        rank.backgroundColor = [UIColor clearColor];
        rank.textAlignment = NSTextAlignmentCenter;
        [self addSubview:rank];
        self.rank = rank;
        
        // 拼论
        UILabel * seqid = [[UILabel alloc]init];
        seqid.numberOfLines = 0;
        seqid.font = [UIFont systemFontOfSize:15];
        seqid.textColor = ZCJColor(240, 140, 19);
        seqid.backgroundColor = [UIColor clearColor];
        seqid.textAlignment = NSTextAlignmentCenter;
        [self addSubview:seqid];
        self.seqid = seqid;
        
        // 浏览量
        UILabel * posttime = [[UILabel alloc]init];
        posttime.numberOfLines = 0;
        posttime.backgroundColor = [UIColor clearColor];
        posttime.textAlignment = NSTextAlignmentCenter;
        posttime.font = [UIFont systemFontOfSize:15];
        posttime.textColor = ZCJColor(240, 140, 19);
        [self addSubview:posttime];
        self.posttime = posttime;
      
        
        // Initialization code
    }
    return self;
}

- (void)awakeFromNib
{
    // Initialization code
}
//  设置数据和frame
- (void)setMyDataFrame:(TravelDecatilFrame *)myDataFrame
{
    _myDataFrame = myDataFrame;
    TravelDecatil * travelDeca = myDataFrame.travelDecatl;
    ZCJLog(@"------%@-----",travelDeca.avatar);
    [self.topView setImageWithURL:[NSURL URLWithString:travelDeca.avatar] placeholderImage:[UIImage imageNamed:@"header"]];
    self.topView.frame = myDataFrame.avatarF;
    // 内容
    self.content.text = travelDeca.content;
    
    self.content.frame = myDataFrame.contentF;
    

    // 用户名
    self.userName.text = travelDeca.username;
    self.userName.frame = myDataFrame.usernameF;
    // 标题
    self.grouptitle.text = travelDeca.grouptitle;
    self.grouptitle.frame = myDataFrame.grouptitleF;
    
    self.status.text = travelDeca.status;
    self.status.frame = myDataFrame.statusF;
    
    // 赞
    self.rank.text = [NSString stringWithFormat:@"赞 %@",travelDeca.rank];
    
    self.rank.frame = myDataFrame.rankF;
    
    self.seqid.text = [NSString stringWithFormat:@"评论 %@",travelDeca.seqid];
    self.seqid.frame = myDataFrame.seqidF;
    
    self.posttime.text = [NSString stringWithFormat:@"浏览量 %@",travelDeca.posttime];
    self.posttime.frame = myDataFrame.posttimeF;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
